package jgrit.options;

/**
 * @author Sam, Taylor
 *
 */
public class MultiOption extends Option {

	private final String[] possibleValues;
	
	/**
	 * @return the possibleValues
	 */
	public String[] getPossibleValues() {
		return possibleValues;
	}

	public MultiOption(String name, String group,
			String initialValue, String[] possibleValues) {
		super(name, group, initialValue);
		this.possibleValues = possibleValues;
	}

	/* (non-Javadoc)
	 * @see jgrit.options.Option#validate()
	 */
	@Override
	public boolean validate() {
		for (String val : possibleValues) {
			if (val.toString().equalsIgnoreCase(this.getValue())) {
				return true;
			}
		}
		return false;
	}
	
	public static void main(String[] args) {
		MultiOption myOpt = new MultiOption("bpp", "gfx",
				"4", new String[] { "1", "2", "4", "8", "16" });
		
		System.out.println(myOpt.getValue());
		System.out.println(myOpt.validate());
		
		myOpt.setValue("Eight");
		System.out.println(myOpt.getValue());
		System.out.println(myOpt.validate());
	}
}
